#!/bin/sh

. /opt/truecl/etc/clenv.sh

user=${1:-root}
h=`hostname`

r=`$TRUECL_CODE/utils/lha_consistency_checker --no`

if [ -n "$r" ]
then
	if [ -x "/usr/bin/mailx" ]
	then
		echo "Problems found with Database consistency across nodes.\n\n$r" | /usr/bin/mailx -s "Cluster Configuration Database issues" $user
		exit 0
	fi
	if [ -x "/usr/bin/mail" ]
	then
		echo "Subject: Cluster Configuration Database issues\nProblems found with Database consistency across nodes.\n\n$r" | 
			/usr/bin/mail $user
	fi
fi

exit 0
